import Vue from 'vue'
import VueRouter from 'vue-router'

import Main from '../views/main.vue'
import Log from '../views/Log'


import Blogs from '../components/proscenium/blog'

import Home from '../components/proscenium/main_home'


Vue.use(VueRouter)

const routes = [
    /*登录路由*/
  {
    path: '/',
    name:'Log',
    component: Log
  },

    /*前台路由*/
  {
    path: '/main',
    name: 'Main',
    component: Main,
    children:[
      {
        path: '/edit',
        name:'Edit',
        component: resolve => require(['../components/proscenium/edit_home'],resolve),
      },
      {
        path: '/oneself',
        name:'Oneself',
        component: resolve => require(['../components/proscenium/oneself_main'],resolve),
        children: [
          {
            path:'/oneself/blogs',
            name: 'Blogs',
            component: resolve => require(['../components/proscenium/home_main'],resolve),
            children: [{
              path: '/oneself/blogs',
              name: 'Blog',
              component: resolve => require(['../components/proscenium/blog'],resolve),
            }]
          },
          {
            path:'/oneself/users',
            name: 'UserList',
            component: resolve => require(['../components/proscenium/User_list'],resolve),
          },
          {
            path: '/oneself',
            name:'Oneself_Home',
            component: resolve => require(['../components/proscenium/oneself_home'],resolve),
            children: [
              {
                path:'/oneself/photo',
                name:'Photo',
                component: resolve => require(['../components/proscenium/photo'],resolve),
              },
                {
                  path:'/oneself',
                  name:'blogs',
                  component: resolve => require(['../components/proscenium/blog'],resolve),
            }
            ]
          }
        ]
      },
      {
        path: '/heat',
        name:"Heat",
        component:resolve => require(["../components/proscenium/heat_main"],resolve),
        children: [
          {
            path: '/heat',
            name:'center',
            component:resolve => require(["../components/proscenium/home_main"],resolve),
            children: [
              {
                path: '/heat',
                name: 'bolgs',
                component: resolve => require(['../components/proscenium/blog'],resolve),
              }
            ]
          },
          {
            path: '/heat/user',
            name:'用户页',
            component: resolve => require(["../components/proscenium/oneself_home"],resolve),
            children:[{
                path: '/heat/user',
                name:'博客',
                component: resolve => require(["../components/proscenium/blog"],resolve),
                meta:{
                  keepalive:false,
                }
              }]
          },
          {
            path: '/topic',
            name:'Topic',
            component: resolve => require(["../components/proscenium/topic"],resolve),
            children: [
                {
                  path: "/topic",
                  name: 'bolgs',
                  component: resolve => require(['../components/proscenium/blog'],resolve),
              }
            ]
          },
        ]
      },
      {
        path:"/main",
        name:"Home",
        component:Home,
        children:[
          {
            path: '/main',
            name:'主页',
            component: resolve => require(["../components/proscenium/home_main"],resolve),
            children:[
              {
                path: '/main',
                name:'全部',
                component: resolve => require(["../components/proscenium/blog"],resolve),
                meta:{
                  keepalive:false,
                }
              },
            ]
          },
          {
            path: '/main/user',
            name:'用户页',
            component: resolve => require(["../components/proscenium/oneself_home"],resolve),
            children:[
              {
                path: '/main/user',
                name:'博客',
                component: resolve => require(["../components/proscenium/blog"],resolve),
                meta:{
                  keepalive:false,
                }
              },
            ]
          },
        ]
      },
    ]
  },

    /*后台路由*/
  // 后台
  {
    path: '/admin',
    redirect:'/admin/admin_earth',
    component: ()=> import('../components/tiring/admin-main'),
    children: [
      {
        path: 'list',
        component: ()=> import('../components/tiring/admin-list'),
      },
      {
        path: 'add',
        component: () => import('../components/tiring/admin_add')
      },
      {
        path: 'update',
        component: () => import('../components/tiring/admin-update'),
      },
      {
        path: 'user/list',
        component: () => import('../components/tiring/user-list')
      },
      {
        path: 'admin_earth',
        component: () => import('../components/tiring/admin_earth')
      },
      {
        path: 'blog/list',
        component:() => import('../components/tiring/blog_list')
      },
      {
        path: 'blog/check',
        component: () => import('../components/tiring/blog_check')
      }

    ]
  },

]

const router = new VueRouter({
  routes
})



export default router
